﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SimpleActor
{
    /// <summary>
    /// Defines the base class of asynchronous operation.
    /// </summary>
    /// <typeparam name="TServant"></typeparam>
    internal abstract class MessageBase<TServant> : IAsyncMessage<TServant> where TServant : IActorServant
    {
        private readonly string methodName;

        protected MessageBase(string methodName)
        {
            this.methodName = methodName;
        }

        protected MessageBase()
            : this(string.Empty)
        {
        }

        public string MethodName
        {
            get { return methodName; }
        }

        public abstract void Invoke(TServant servant);

        public abstract void Abort(Func<Exception> newException);
    }
}
